{extend name="public:base" /}
{block name="content"}	
<div class="page-header">
		<h1>
			{$breadcrumb1}
			<small>
				<i class="ace-icon fa fa-angle-double-right"></i>
				{$breadcrumb2}
			</small>
			<small>
				<i class="ace-icon fa fa-angle-double-right"></i>
				{$crumbs}
			</small>			
			<button id="send" form="form-goods" type="submit" style="float:right;"  class="btn btn-sm btn-primary">提交</button>			
		</h1>
</div>
	<div class="row">
	<div class="col-xs-12">	
		<div class="panel-body">
        <form action="{:url('Contract/update')}" method="post" enctype="multipart/form-data" id="form-goods" class="form-horizontal">
          <ul class="nav nav-tabs">
          	<li class="active"><a href="#tab-data" data-toggle="tab">基本信息</a></li>
          </ul>
          <div class="tab-content">

	          	<!-- 基本信息 START -->
	          	<div class="tab-pane active" id="tab-data">
					<input type="hidden" name="id" value="{$info.id}"/>
		            <div class="form-group required">
						<label class="col-sm-2 control-label" for="name">合约名称：</label>
						<div class="col-sm-10">
							<input id="name" class="form-control" type="text" placeholder="合约名称" value="{$info.name}" name="name">
						</div>
					</div>
					<div class="form-group required">
						<label class="col-sm-2 control-label" for="type">合约类型：</label>
						<div class="col-sm-10">
							<select class="form-control" id="type" name="type">
								<option value="1" {if condition="$info.type eq 1"} selected {/if}>自由买卖</option>
								<option value="2" {if condition="$info.type eq 2"} selected {/if}>目标价认购</option>
							</select>
						</div>
					</div>
		            <div class="form-group required">
						<label class="col-sm-2 control-label" for="remark">合约介绍：</label>
						<div class="col-sm-10">
							<input id="remark" class="form-control" type="text" placeholder="合约介绍" value="{$info.remark}" name="remark">
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label" for="content">合约详情：</label>
						<div class="col-sm-10">
							<textarea name="content" id="content">{$info.content}</textarea>
						</div>
					</div>
	          	</div>
	          	<!-- 基本信息 END -->
          </div>
        </form>
	</div>
	</div>
</div>
{/block}
{block name="javascript"}

<script src="__PUBLIC__/js/ckeditor/ckeditor.js"></script> 
<script>

$('#send').click(function(){

	var title=$('input[name="title"]').val();

	var money=$('input[name="money"]').val();

	var option_quantity=$('.quantity').size();

	var option=$(".option").size();

	var send=true;

	if(title==''){
		alert('活动标题必填');
		return false;
	}
	if(money==''){
		alert('花费金额必填');
		return false;
	}

	if(send==true){
		return true;
	}
	return false;
}); 

//CKEDITOR
CKEDITOR.replace('content', {
	filebrowserImageUploadUrl: '{:url("FileManager/ckupload")}',
	toolbar: [
				[ 'Source', 'Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat' ],
				[ 'FontSize', 'TextColor', 'BGColor' ],
				[ 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock','Image','Format']
			]
});

/*******************************************************************************************************************/

</script>
{/block}